<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use yii\helpers\ArrayHelper;
use common\models\Depot;
use kartik\dynagrid\DynaGrid;

/* @var $this yii\web\View */
/* @var $searchModel common\models\DepotPositionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '仓位管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<?php $this->beginBlock('content-header') ?>
<?= $this->title ?>
<?php $this->endBlock() ?>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>


    <div class="box box-primary">
        <div class="box-body">
        <?=
        DynaGrid::widget([
            'columns' => [
                'id',
                'sn',
                [
                    'attribute'=>'depot_id',
                    'label'=>'仓库',
                    'value'=>'depot.name',
                    'filterType' =>GridView::FILTER_SELECT2,
                    'filter' =>ArrayHelper::map(Depot::find()->all(),'id','name'),
                    'filterWidgetOptions' => [
                        'pluginOptions' => ['allowClear' => true],
                    ],
                    'filterInputOptions' => ['placeholder' => '请选择'],
                ],
                'created_at:datetime:创建时间',
                ['class' => 'kartik\grid\ActionColumn','template'=>'{update}{delete}','dropdown'=>true,'dropdownButton'=>['label'=>'工具箱','class'=>'btn btn-default'],  'dropdownOptions' => ['class' => 'float-right'],'headerOptions' => ['class' => 'kartik-sheet-style']],
                ],
            'storage'=>DynaGrid::TYPE_COOKIE,
            'theme'=>'panel-danger',
            'gridOptions'=>[
                'dataProvider'=>$dataProvider,
                'filterModel'=>$searchModel,
                'panel'=>[
                    'heading'=>false,
                    'type'=>'success',
                    'before'=>Html::a('<i class="glyphicon glyphicon-plus"></i>创建仓位', ['create'], ['class' => 'btn btn-success']),
                ],
            ],
            'options'=>['id'=>'dynagrid-1'] // a unique identifier is important
        ]);
        ?>
        
        
        
        </div>
    </div>

